package com.krio.spaceship;

import org.cocos2d.nodes.CCDirector;
import org.cocos2d.nodes.CCTextureCache;
import org.cocos2d.opengl.CCTexture2D;
import org.cocos2d.particlesystem.CCParticleSystem;
import org.cocos2d.particlesystem.CCPointParticleSystem;
import org.cocos2d.types.CGPoint;
import org.cocos2d.types.CGSize;
import org.cocos2d.types.ccBlendFunc;


public class ParticleGalaxy extends CCPointParticleSystem{



	protected ParticleGalaxy(int numberOfParticles) {
		super(numberOfParticles);
		

		duration = kCCParticleDurationInfinity;

		// Gravity Mode
		this.setEmitterMode(kCCParticleModeGravity);

		// Gravity Mode: gravity
		this.setGravity(CGPoint.ccp(0,0));

		// Gravity Mode: speed of particles
		this.setSpeed(60);
		this.setSpeedVar(10);

		// Gravity Mode: radial
		this.radialAccel = -80;
		this.radialAccelVar = 0;

		// Gravity Mode: tagential
		this.tangentialAccel = 80;
		this.tangentialAccelVar = 0;

		// angle
		angle = 90;
		angleVar = 360;

		// emitter position
		CGSize winSize = CCDirector.sharedDirector().winSize();
		this.setPosition(winSize.width/2, winSize.height/2);
		posVar = CGPoint.ccp(0,0);

		// life of particles
		life = 4;
		lifeVar = 1;

		// size, in pixels
		this.setStartSize(37);

		//this.setStartRadiusVar(10f);
		this.setEndSize(kCCParticleStartSizeEqualToEndSize);

		// emits per second
		emissionRate = totalParticles/life;

		// color of particles
		startColor.r = 0.12f;
		startColor.g = 0.25f;
		startColor.b = 0.76f;
		startColor.a = 1.0f;
		startColorVar.r = 0.0f;
		startColorVar.g = 0.0f;
		startColorVar.b = 0.0f;
		startColorVar.a = 0.0f;
		endColor.r = 0.0f;
		endColor.g = 0.0f;
		endColor.b = 0.0f;
		endColor.a = 1.0f;
		endColorVar.r = 0.0f;
		endColorVar.g = 0.0f;
		endColorVar.b = 0.0f;
		endColorVar.a = 0.0f;

		CCTexture2D t = CCTextureCache.sharedTextureCache().addImage("particle1.png");
		this.setTexture(t);
		

		// additive
		this.setBlendAdditive(false);
	
	}

	@Override
	public ccBlendFunc getBlendFunc() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void setBlendFunc(ccBlendFunc arg0) {
		// TODO Auto-generated method stub
		
	}



}
